package com.example.workflow.filter;//package com.example.workflow.filter;
//
//import lombok.Getter;
//import lombok.Setter;
//import org.springframework.security.authentication.AbstractAuthenticationToken;
//import org.springframework.security.core.GrantedAuthority;
//import org.springframework.stereotype.Component;
//
//import java.util.Collection;
//
///**
// * 注意这个类名与SpringSecurity自带的有重名，后续不要引入错包了
// */
//
//@Getter
//@Setter
//public class UsernamePasswordAuthenticationToken  extends AbstractAuthenticationToken {
//
//    private final Object principal;
//
//    private Object credentials;
//
//    /**
//     * 验证码
//     */
//    @Getter
//    @Setter
//    private String captcha;
//
//    public UsernamePasswordAuthenticationToken(Object principal, Object credentials, Collection<? extends GrantedAuthority> authorities) {
//        super(authorities);
//        this.principal = principal;
//        this.credentials = credentials;
//        super.setAuthenticated(true);
//    }
//
//    public UsernamePasswordAuthenticationToken(Object principal, Object credentials) {
//        super(null);
//        this.principal = principal;
//        this.credentials = credentials;
//        super.setAuthenticated(false);
//    }
//
//    public static UsernamePasswordAuthenticationToken unauthenticated(Object principal, Object credentials) {
//        return new UsernamePasswordAuthenticationToken(principal, credentials);
//    }
//
//    public static UsernamePasswordAuthenticationToken authenticated(Object principal, Object credentials,
//                                                                    Collection<? extends GrantedAuthority> authorities) {
//        return new UsernamePasswordAuthenticationToken(principal, credentials, authorities);
//    }
//
//    @Override
//    public Object getCredentials() {
//        return credentials;
//    }
//
//    @Override
//    public Object getPrincipal() {
//        return principal;
//    }
//
//    @Override
//    public void eraseCredentials() {
//        super.eraseCredentials();
//        this.credentials = null;
//    }
//
//    @Override
//    public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException {
//        if (isAuthenticated) {
//            throw new IllegalArgumentException("无法将此令牌设置为受信任，只能使用构造函数，该构造函数接受GrantedAuthority列表。");
//        }
//        super.setAuthenticated(false);
//    }
//}
//
